package com.xiaobai.zhuangxiuguanjia.model;

import org.json.JSONArray;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2015/6/15 0015.
 */
public class HeadInfo {
    private String version;
    private String action;
    private int errorCode;
    private int allRows;
    private List<DesignData> dataList;

    public void parseJSON(JSONObject json){
        version = json.optString("version");
        action = json.optString("action");
        errorCode = json.optInt("errorCode");
        allRows = json.optInt("allRows");
        dataList = new ArrayList<DesignData>();
        JSONArray data = json.optJSONArray("data");
        for (int i = 0; i < data.length() ; i++) {
            JSONObject jsonObject = data.optJSONObject(i);
            DesignData designData = new DesignData();
            designData.parseJSON(jsonObject);
            dataList.add(designData);
        }
    }

    public String getVersion() {
        return version;
    }

    public String getAction() {
        return action;
    }

    public int getErrorCode() {
        return errorCode;
    }

    public int getAllRows() {
        return allRows;
    }

    public List<DesignData> getDataList() {
        return dataList;
    }
}
